﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AjaxControlToolkit;
using DOTNETGROUP.Entities;
using DOTNETGROUP.Data;

public partial class Controls_ControlThietKeWebLeft : System.Web.UI.UserControl
{
    AccordionPane pn;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindingTourToAcr();
        }
    }
    Literal lbTitle;
    Literal lbContent;
    private void BindingTourToAcr()
    {
        int TotalRows = 0;

        // Get ID của tour độc đáo
        TList<LoaiThietKeWeb> TList_LoaiTour = DataRepository.LoaiThietKeWebProvider.GetPaged("TrangThai = 1", "Id", 0, 0, out TotalRows);

        string strHTML_Header = "";
        string strHTML_Content = "";
        if (TList_LoaiTour.Count > 0)
        {
            for (int i = 0; i < TList_LoaiTour.Count; i++)
            {
                lbTitle = new Literal();
                lbContent = new Literal();
                strHTML_Header = "";
                strHTML_Header = "<div class='accor_left'>";
                strHTML_Header += "<font style='padding-left: 15px;'>" + TList_LoaiTour[i].TenLoaiThietKeWeb + "</font></div>";
                lbTitle.Text = strHTML_Header;

                strHTML_Content = "";
                strHTML_Content += Server.HtmlDecode(TList_LoaiTour[i].NoiDung) == null ? "Chưa cập nhật dữ liệu" : Server.HtmlDecode(TList_LoaiTour[i].NoiDung) + "<br/>";

                pn = new AccordionPane();
                pn.ID = "Pane" + i;
                pn.HeaderContainer.Controls.Add(lbTitle);
                pn.ContentContainer.Controls.Add(lbContent);

                acrThietKeWeb.Panes.Add(pn);

                lbContent.Text = strHTML_Content;
            }
        }
    }

    public string GetTieuDe(object Char)
    {
        string s = Char.ToString();
        return Common.ConvertToUnSign(s);
    }
}